/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.marlboroug.entity;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;


@Entity
@Table(name = "Editors")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Editors.findAll", query = "SELECT e FROM Editors e"),
    @NamedQuery(name = "Editors.findByIDeditors", query = "SELECT e FROM Editors e WHERE e.iDeditors = :iDeditors"),
    @NamedQuery(name = "Editors.findByName", query = "SELECT e FROM Editors e WHERE e.name = :name")})
public class Editors implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "ID_editors")
    private Long iDeditors;
    @Size(max = 45)
    @Column(name = "name")
    private String name;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idEditors")
    private Collection<Articles> articlesCollection;

    public Editors() {
    }

    public Editors(Long iDeditors) {
        this.iDeditors = iDeditors;
    }

    public Long getIDeditors() {
        return iDeditors;
    }

    public void setIDeditors(Long iDeditors) {
        this.iDeditors = iDeditors;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @XmlTransient
    public Collection<Articles> getArticlesCollection() {
        return articlesCollection;
    }

    public void setArticlesCollection(Collection<Articles> articlesCollection) {
        this.articlesCollection = articlesCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (iDeditors != null ? iDeditors.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Editors)) {
            return false;
        }
        Editors other = (Editors) object;
        if ((this.iDeditors == null && other.iDeditors != null) || (this.iDeditors != null && !this.iDeditors.equals(other.iDeditors))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.marlboroug.entity.Editors[ iDeditors=" + iDeditors + " ]";
    }
    
}
